<?php

/*
 * core/user_service.php
 *
 * Service to expose user administration
 */

require_once( 'user.php' );

Service::register( 'UserService', 'User Service', 'Provide User Administration interface' );

class UserService extends Service
{
	public function __construct()
	{
		parent::__construct();
		$this->registerMethod( 'getInfo', array(T_STR ), 'Get User Information', 'helpless', false );
		$this->registerMethod( 'add', array(T_STR, T_STR, T_STR), 'Add new user', 'helpless', false );
		$this->registerMethod( 'remove', array(T_STR), 'Remove existing user', 'helpless', false );
		$this->registerMethod( 'update', array(T_STR, T_STR, TO_STR), 'Update existing user', 'helpless', false );
		$this->registerMethod( 'listUsers', array(), 'List all users', 'helpless', false );
	}

	public function getInfo( $user )
	{
		return User::getInfo( $user );
	}

	public function add( $username, $password, $email )
	{
		return User::add( $username, $password, $email );
	}

	public function remove( $user )
	{
		return User::remove( $user );
	}

	public function update( $username, $password, $email=null )
	{
		return User::update( $username, $password, $email );
	}

	public function listUsers()
	{
		return User::listUsers();
	}
}

?>
